/* Author(s):
 *   Ben Brewer (ben.brewer@codethink.co.uk)
 *
 * Copyright (c) 2012 Codethink (http://www.codethink.co.uk)
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */



%{
#include <stdio.h>
#include "parser.h"
%}

%option noyywrap
%option prefix="essl_yy"

%%


attribute   return ATTRIBUTE;
const       return CONST;
bool        return BOOL;
float       return FLOAT;
int         return INT;
break       return BREAK;
continue    return CONTINUE;
do          return DO;
else        return ELSE;
for         return FOR;
if          return IF;
discard     return DISCARD;
return      return RETURN;
bvec2       return BVEC2;
bvec3       return BVEC3;
bvec4       return BVEC4;
ivec2       return IVEC2;
ivec3       return IVEC3;
ivec4       return IVEC4;
vec2        return VEC2;
vec3        return VEC3;
vec4        return VEC4;
mat2        return MAT2;
mat3        return MAT3;
mat4        return MAT4;
in          return IN;
out         return OUT;
inout       return INOUT;
uniform     return UNIFORM;
varying     return VARYING;
sampler2D   return SAMPLER2D;
samplerCube return SAMPLERCUBE;
struct      return STRUCT;
void        return VOID;
while       return WHILE;

invariant return INVARIANT;
superp    return SUPER_PRECISION;
highp     return HIGH_PRECISION;
mediump   return MEDIUM_PRECISION;
lowp      return LOW_PRECISION;
precision return PRECISION;

true|false             return BOOLCONSTANT;
[_a-zA-Z][_a-zA-Z0-9]* return IDENTIFIER;
[0-9]+\.[0-9]+         return FLOATCONSTANT;
[0-9]+                 return INTCONSTANT;
"0x"[0-9a-fA-F]+       return INTCONSTANT;
"0b"[0-1]+             return INTCONSTANT;
"<<"                   return LEFT_OP;
">>"                   return RIGHT_OP;
"++"                   return INC_OP;
"--"                   return DEC_OP;
"<="                   return LE_OP;
">="                   return GE_OP;
"=="                   return EQ_OP;
"!="                   return NE_OP;
"&&"                   return AND_OP;
"||"                   return OR_OP;
"^^"                   return XOR_OP;
"*="                   return MUL_ASSIGN;
"/="                   return DIV_ASSIGN;
"+="                   return ADD_ASSIGN;
"%="                   return MOD_ASSIGN;
"<<="                  return LEFT_ASSIGN;
">>="                  return RIGHT_ASSIGN;
"&="                   return AND_ASSIGN;
"^="                   return XOR_ASSIGN;
"|="                   return OR_ASSIGN;
"-="                   return SUB_ASSIGN;

"(" return LEFT_PAREN;
")" return RIGHT_PAREN;
"[" return LEFT_BRACKET;
"]" return RIGHT_BRACKET;
"{" return LEFT_BRACE;
"}" return RIGHT_BRACE;
"." return DOT;
"," return COMMA;
":" return COLON;
"=" return EQUAL;
";" return SEMICOLON;
"!" return BANG;
"-" return DASH;
"~" return TILDE;
"+" return PLUS;
"*" return STAR;
"/" return SLASH;
"%" return PERCENT;
"<" return LEFT_ANGLE;
">" return RIGHT_ANGLE;
"|" return VERTICAL_BAR;
"^" return CARET;
"&" return AMPERSAND;
"?" return QUESTION;

"/*"([^\*]\*[^/])"*/"  /* ignore multi-line  comments */;
"//"[^\n]*\n           /* ignore single-line comments */;
[ \t\r\n]+             /* ignore whitespace */;
%%
